
 
 F u n c t i o n :   d e s t r o y ( o b j e c t D C O r I D ,   b o o l K e e p I n t e r n a l C o n t e n t ,   b o o l B o u n d T o E l e m e n t ) 
 
 
 
 D e s c r i p t i o n :   D e s t r o y s   a   D C   o b j e c t   t h a t   w a s   p r e v i o u s l y   c r e a t e d   u s i n g   $ A ( d c A r r a y )   o r   $ A . t o D C ( ) . 
 
 
 
 R e t u r n s :   B o o l e a n :   T r u e   i f   s u c c e s s f u l ,   f a l s e   o t h e r w i s e . 
 
 
 
 N o t e :   I f   b o o l K e e p I n t e r n a l C o n t e n t   i s   f a l s e   o r   u n d e f i n e d ,   o r   i f   t h e   D C   o b j e c t   i s   c l o s e d ,   d e s t r o y   w i l l   c l e a n   a n d   r e m o v e   a l l   i n t e r n a l l y   s t o r e d   D O M   n o d e s   a s s o c i a t e d   w i t h   t h e   D C   o b j e c t .   I f   b o o l K e e p I n t e r n a l C o n t e n t   i s   t r u e   a n d   t h e   D C   o b j e c t   r e m a i n s   o p e n ,   a l l   d i s p l a y e d   c o n t e n t   w i t h i n   t h e   D C   o b j e c t   w i l l   b e   p r e s e r v e d   a t   i t s   c u r r e n t   l o c a t i o n   i n   t h e   D O M   b e f o r e   t h e   a s s o c i a t e d   D C   o b j e c t   i s   d e s t r o y e d .   I f   b o o l B o u n d T o E l e m e n t   i s   s e t   t o   t r u e ,   a l l   D C   o b j e c t s   t h a t   a r e   b o u n d   t o   t h e   t r i g g e r i n g   e l e m e n t   p a s s e d   a s   t h e   f i r s t   p a r a m e t e r   w i l l   b e   d e s t r o y e d . 
 
 
 
 I f   a   f u n c t i o n   i s   d e c l a r e d   f o r   D C . b e f o r e D e s t r o y ( ) ,   t h i s   h a n d l e r   w i l l   a u t o m a t i c a l l y   b e   e x e c u t e d   b e f o r e   t h e   d e s t r o y   p r o c e s s   i s   p e r f o r m e d . 
 
 
 
 E x a m p l e : 
 
 
 
 D C . b e f o r e D e s t r o y   =   f u n c t i o n ( D C )   { 
 
     / /   D o   s o m e t h i n g   b e f o r e   t h e   D C   o b j e c t   i s   d e s t r o y e d . 
 
 } ; 
 
 
 
 / /   D e s t r o y   t h e   r e f e r e n c e d   D C   o b j e c t . 
 
 $ A . d e s t r o y ( D C ) ; 
 
 
 
 / /   O r   u s i n g   t h e   D C   o b j e c t   i d . 
 
 
 
 $ A . d e s t r o y ( " d c I d " ) ; 
 
 
 
 / /   D e s t r o y   a l l   D C   o b j e c t s   b o u n d   t o   t h e   r e f e r e n c e d   t r i g g e r i n g   e l e m e n t   a n d   r e m o v e   t h e i r   c o n t e n t . 
 
 
 
 $ A . d e s t r o y ( d o m N o d e F o r T r i g g e r i n g E l e m e n t ,   f a l s e ,   t r u e ) ; 
 
 